﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TimeAxis
{
    public partial class Detail : System.Web.UI.Page
    {
        public Models.Doc doc = null;
        protected void Page_Load(object sender, EventArgs e)
        {

            DavidDB.ADO.DBManager db = new DavidDB.ADO.DBManager();
            doc = Impls.ImplDoc.GetInstance(db).GetModel(Convert.ToInt32(Request.QueryString["docid"]));
            this.LoginButton.Text = "赞(" + doc.GoodCount + ")";
            db.Commit();
            db.Dispose();
        }

        protected void LoginButton_Click(object sender, EventArgs e)
        {
            DavidDB.ADO.DBManager db = new DavidDB.ADO.DBManager();
            doc = Impls.ImplDoc.GetInstance(db).GetModel(Convert.ToInt32(Request.QueryString["docid"]));
            doc.GoodCount = doc.GoodCount + 1;
            Impls.ImplDoc.GetInstance(db).Edit(doc);
            db.Commit();
            db.Dispose();
            Response.Redirect("Detail.aspx?docid=" + Request.QueryString["docid"]);
        }
    }
}